<?php
/**
 * Holds global information about objects.
 *
 * @author Mark Dohmen.
 */
final class ObjectDefinition {
	
	/**
	 * Holds a set of definitions in an Array.
	 */
	private static $objectDefinitions;
	
	/**
	 * Add's a definition to the array.
	 *
	 * @param $objectDefinition
	 */
	final public static function addDefinition(ObjectDefinition $objectDefinition) {
		self::$objectDefinitions[$objectDefinition->getId()] = $objectDefinition;
	}
	
	/**
	 * Gets an ObjectDefinition by #id.
	 *
	 * @return $objectDefinition/null
	 */
	final public static function forId(int $id) {
		if (self::$objectDefinitions[$id] instanceof ObjectDefinition) {
			return (object) self::$objectDefinitions[$id];
		}
		return NULL;
	}
	
	/**
	 * The id.
	 */
	private $id;
	
	/**
	 * The objects name
	 */
	private $name;
	
	/**
	 * The objects description
	 */
	private $description;
	
	/**
	 * Class Constructor..
	 *
	 * @param $id
	 * @param $name
	 * @param $description
	 */
	final public function ObjectDefinition(int $id, string $name, string $description) {
		$this->id = $id;
		$this->name = $name;
		$this->description = $description;
	}
	
	/**
	 * Gets the ID.
	 *
	 * @return $id
	 */
	final public function getId() {
		return (int) $this->id;
	}
	
	/**
	 * Gets the name.
	 *
	 * @return $name
	 */
	final public function getName() {
		return (string) $this->name;
	}
	
	/**
	 * Gets the description.
	 *
	 * @return $description
	 */
	final public function getDescription() {
		return (string) $this->description;
	}
}
?>